<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button id="btn">点我创建一个新的列表项</button>
    <ul id="list"></ul>
</body>
<script>
    var oBtn = document.getElementById('btn');
    var oList = document.getElementById('list');

    oBtn.onclick = function () {
        // 创建新的li元素
        var oLi = document.createElement('li');
        // 写内容
        oLi.innerHTML = '我是新来的';
        // 上树
        oList.appendChild(oLi);
    }

    oList.onclick = function (e) {
        // e.target表示用户真正点击的那个元素
        e.target.style.color = 'red';
    }
</script>
</html>